MQTT thermostat: unquote payloads#11347
Closed
tinloaf wants to merge 1 commit into
Closed
Conversation
balloob
requested changes
Jan 11, 2018
Member
balloob
left a comment
There was a problem hiding this comment.
This is a hack and confusing to our users. Will probably bite us in the future.
It's also not "Unquoting". The values are JSON encoded and should be decoded.
So we should either add a config option to treat incoming data as JSON instead of text or add value_template config option for each topic and allow the user to do this themselves.
Contributor
Author
|
I agree this was a hacky approach. So, then I'd vote for adding a I'll get to it today, hopefully. |
4 tasks
Contributor
Author
|
I not only re-decided to go with templating, I also opened a new PR in #11623 to have a clean history. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
For payloads incoming via the
*_STATEMQTT channels, we should unquote them if they are quoted.This targets a (probably pretty common) use case of using the MQTT thermostat with another HA instance on the other side, and using
mqtt_statestreamfor the*_STATEchannels. Since #9872 , the values set from the "master" HA instance will be echoed in a quoted form on the state channels by the "slave" HA instance, causing errors. There is currently no easy way of circumventing this.I thought about making unquoting optional, but I don't think we do any harm just always trying this. We always try setting both quoted and unquoted form, so nothing that works now should break. There are two scenarios where I could imagine trouble:
FOOas well as"FOO"in theiroperations_list(or any other list), this will break. But this seems like an insane configuration."FOO"as theirhold_mode, unquoting would turn this intoFOO, since we don't have a list of values for thehold_mode, and thus always apply unquoting here.Related issue (if applicable): fixes parts of #10209
If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass